package com.ustudy.entity.ec;

import java.util.Collections;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.ustudy.core.dao.support.entity.LongIdEntity;
/**
 * 商品货架
 * @author caizh
 *
 */
@SuppressWarnings("serial")
@Entity(name="GoodsStore")
@Table(name="EC_GOODS_TYPE")
public class GoodsStore extends LongIdEntity {
	
	private String name;
	
	@ManyToOne(cascade={CascadeType.REFRESH},fetch=FetchType.LAZY)
	@JoinColumn(name="P_ID")
	private GoodsStore parent;
	
	@OneToMany(cascade={CascadeType.REMOVE},fetch=FetchType.LAZY,mappedBy="parent")
	private List<GoodsStore> children=Collections.emptyList();

	public String getName() {
		return name;
	}

	public GoodsStore getParent() {
		return parent;
	}

	public void setParent(GoodsStore parent) {
		this.parent = parent;
	}

	public List<GoodsStore> getChildren() {
		return children;
	}

	public void setChildren(List<GoodsStore> children) {
		this.children = children;
	}

	public void setName(String name) {
		this.name = name;
	}


}
